//
//  InfoView.swift
//  Automobile
//
//  Created by erkebulan elzhan on 8/19/20.
//  Copyright © 2020 erkebulan elzhan. All rights reserved.
//

import UIKit
import SnapKit

final class CardView: UIView {
    
    class CardType {
        static let info = UIColor.rgb(230, 245, 238)
        static let warn = UIColor.rgb(246, 228, 228)
    }
    
    private lazy var textLbl: UILabel = {
        let lbl = UILabel()
        lbl.font = UIFont.systemFont(ofSize: 14, weight: .regular)
        lbl.textColor = .mediumDarkBlue
        lbl.textAlignment = .left
        lbl.sizeToFit()
        lbl.numberOfLines = 0
        return lbl
    }()
    
    init (text: String, color: UIColor) {
        super.init(frame: .zero)
        self.addViews()
        self.textLbl.text = text
        self.backgroundColor = color
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func addViews () {
        self.layer.cornerRadius = 5
        self.addSubview(textLbl)
        textLbl.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview().inset(10)
            make.leading.trailing.equalToSuperview().inset(16)
            make.center.equalToSuperview()
        }
    }
}
